import { post } from '@/utils/axios';
import commonHandle from '@/api/commonHandle';

/** ******************************************** divisionConsumptionTrend 6563 start ********************************************** */

export interface IDivisionConsumptionTrendResult {
  code: number;
  message: string;
  data: {
    xAxis: number[];
    income: {
      name: string;
      data: number[];

    };
    completionProgress: {
      name: string;
      data: number[];

    };
    timeSchedule: {
      name: string;
      data: number[];

    };

  };

}

export interface IDivisionConsumptionTrendResultCallBackOptions {
  successCb?: (res: IDivisionConsumptionTrendResult) => void;
  errorCb?: (res: IDivisionConsumptionTrendResult) => void;
  completeCb?: (res: IDivisionConsumptionTrendResult) => void;
  failCb?: (res: IDivisionConsumptionTrendResult) => void;
}

/* 分月管会趋势
* http://172.19.10.8:38085/project/36/interface/api/6563
* @author chenjiajun

* @returns
*/

export function divisionConsumptionTrend(options?: IDivisionConsumptionTrendResultCallBackOptions): Promise<IDivisionConsumptionTrendResult> {
  const promiseRes = post<IDivisionConsumptionTrendResult>('/api/dataBoard/divisionConsumptionTrend');
  return commonHandle<IDivisionConsumptionTrendResult, IDivisionConsumptionTrendResultCallBackOptions>(promiseRes, options);
}

/** ******************************************** divisionConsumptionTrend 6563 end ********************************************** */

/** ******************************************** getSMSVerificationCode 6500 start ********************************************** */

export interface IGetSMSVerificationCodeResult {
  code: number;
  message: string;
  data: {
    time: number;

  };

}

export interface IGetSMSVerificationCodeData {
  phoneNumber: number;

}

export interface IGetSMSVerificationCodeResultCallBackOptions {
  successCb?: (res: IGetSMSVerificationCodeResult) => void;
  errorCb?: (res: IGetSMSVerificationCodeResult) => void;
  completeCb?: (res: IGetSMSVerificationCodeResult) => void;
  failCb?: (res: IGetSMSVerificationCodeResult) => void;
}

export function getSMSVerificationCode(params: IGetSMSVerificationCodeData, options?: IGetSMSVerificationCodeResultCallBackOptions): Promise<IGetSMSVerificationCodeResult> {
  const promiseRes = post<IGetSMSVerificationCodeResult>('/api/common/aaaaa', params);
  return commonHandle<IGetSMSVerificationCodeResult, IGetSMSVerificationCodeResultCallBackOptions>(promiseRes, options);
}

/** ******************************************** getSMSVerificationCode 6500 end ********************************************** */
